<template>
  <div>
    <FormPanel ref="formpanel" :list="formList" labelWidth="100" @formChange="formchangeFun" />
    <FilterTable
      ref="table"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :datakey="'rows'"
      :onColumnsChange="columns => (this.columns = columns)"
      columnsRef="zjexchanging"
    ></FilterTable>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
      <el-button @click="closeDrawer()">返 回</el-button>
    </div>
  </div>
</template>
<script>
import { dictionary } from '@/utils/dictMixin';
import { getTabledetail } from '@/api/repair/business/customer/history';
import { invalid } from 'moment';
export default {
  name: 'zjExchanging',
  props: ['getdata'],
  data() {
    this.table = null;
    return {
      formList: this.createFrom(),
      columns: this.createTable(),
      fetchApi: getTabledetail,
      fetchParams: {
        sort: 'TECHNICIAN',
        order: 'asc',
        limit: '10',
        offset: '0',
        labourName: this.getdata.projectName,
        item_id: '3127',
        dms_assign: '',
        dmsFuncId: '35100010',
        _: '1565664628610',
        RO_NO: this.getdata.RO_NO
      }
    };
  },
  methods: {
    createFrom() {
      return [
        {
          type: 'INPUT',
          label: '项目名称',
          fieldName: 'LABOUR_NAME',
          initialValue: this.getdata.projectName,
          disabled: true
        },
        {
          type: 'INPUT',
          label: '派工工时',
          fieldName: 'LABOUR_POSITION_CODE'
        },
        {
          type: 'INPUT',
          label: '检查结果',
          fieldName: 'cid'
        }
      ];
    },
    createTable() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '责任技师',
          dataIndex: 'TECHNICIAN',
          sorter: true,
          filter: true,
          render: props => {
            return <span>{props.row.TECHNICIAN}</span>;
          }
        },
        {
          title: '工位',
          dataIndex: 'LABOUR_POSITION_CODE',
          sorter: true,
          filter: true,
          render: props => {
            return <span>{props.row.LABOUR_POSITION_CODE}</span>;
          }
        },
        {
          title: '工种',
          dataIndex: 'WORKER_TYPE_CODE',
          sorter: true,
          filter: true,
          render: props => {
            return <span>{props.row.WORKER_TYPE_CODE}</span>;
          }
        },
        {
          title: '派工工时',
          dataIndex: 'ASSIGN_LABOUR_HOUR',
          sorter: true,
          filter: true,
          render: props => {
            return <span>{props.row.ASSIGN_LABOUR_HOUR}</span>;
          }
        },
        {
          title: '开工时间',
          dataIndex: 'ITEM_START_TIME',
          sorter: true,
          filter: true,
          render: props => {
            return <span>{props.row.ITEM_START_TIME}</span>;
          }
        },
        {
          title: '完工时间',
          dataIndex: 'ITEM_END_TIME',
          sorter: true,
          filter: true,
          render: props => {
            return <span>{props.row.ITEM_END_TIME}</span>;
          }
        }
      ];
    },
    formchangeFun(val) {},
    closeDrawer() {
      this.$emit('close', false);
    }
  }
};
</script>
